#pragma once
#include <iostream>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <cstring>
#include <memory>
#include <unistd.h>

enum ExitCode // 退出码
{
    OK = 0,
    USAGE_ERR,
    SOCKET_ERR,
    BIND_ERR,
    LISTEN_ERR,
    CONNECT_ERR,
    FORK_ERR
};

class Nocopy
{
public:
    Nocopy() {}
    // 服务器禁止拷贝
    Nocopy(const Nocopy &) = delete;            // 拷贝构造
    Nocopy &operator=(const Nocopy &) = delete; // 赋值
    ~Nocopy() {}
};

#define CONV(addr) ((struct sockaddr *)&addr)